package com.sumainfor.wx.system.maket.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.system.feign.BaseFeignMarket;
import com.sumainfor.wx.system.feign.BaseFeignTenant;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *   房源筛选
 * <p>
 *
 * @author: zc
 * @create: 2019-08-20 14:10
 **/
@Controller
@RequestMapping("/MarketHousingController")
public class MarketHousingController {

    @Autowired
    BaseFeignTenant baseFeignTenant;

    @Autowired
    BaseFeignMarket baseFeignMarket;


    /**
     * 按条件查询房源
     * @author zhoucong
     * @data 2019/8/20
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/findHousingList")
    public JsonResult findHousingList(@RequestParam Map<String,Object> params){
        return baseFeignTenant.findHousingList(params);
    }

    /**
     * 查询省
     * @author zhoucong
     * @data 2019/8/20
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getProvinceList")
    public JsonResult getProvinceList(@RequestParam Map<String,Object> params){
        return baseFeignMarket.getProvinceList(params);
    }


    /**
     * 查询市
     * @author zhoucong
     * @data 2019/8/20
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getCityList")
    public JsonResult getCityList(@RequestParam Map<String,Object> params){
        return baseFeignMarket.getCityList(params);
    }


    /**
     * 查询区
     * @author zhoucong
     * @data 2019/8/20
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getDistrictList")
    public JsonResult getDistrictList(@RequestParam Map<String,Object> params){
        return baseFeignMarket.getDistrictList(params);
    }


    /**
     * 获得热门搜索排行数据
     *
     * @param size
     * @return
     */
    @RequestMapping("/getSearchHot")
    public JsonResult getSearchHot(@RequestParam(value = "size", required = false, defaultValue = "10") Integer size) {
        return baseFeignTenant.getSearchHot(size);
    }

    /**
     * 获得历史搜索记录
     *
     * @return
     */
    @RequestMapping("/getHistorySearchList")
    public JsonResult getHistorySearchList() {
        return baseFeignTenant.getHistorySearchList();

    }
}
